{% extends 'task/_task.html' %}
{% from '_macros.html' import modal_botton %}
{% from 'plugin/#plan_doing.html' import plan_item %}
{% from 'plugin/#plan_detail.html' import plan_detail %}
{% block ac_doing %} active actmore {% endblock %}


{% block top_bar %}
<a class="btn btn-success" href="{{ url_for('.task_create') }}" role="button">+任务</a>
<a class="btn btn-info" href="{{ url_for('plan.plan_create') }}" style="margin-left: 5px;">+计划</a>
{% endblock %}

<!-- 1 待完成任务列表 -->
{% block show %}
{% for plan in plans %}
    {{ plan_item(plan) }}
{% endfor %}
{{ plan_detail()}}
<hr>

{% for i in range(tasks.__len__() // 2 + 1) %}
<div class="row">
    {% for j in range(2) %} {% set index = 2 * i + j %} {% if index < tasks.__len__() %} 
    {% set task = tasks[index] %}
    <div class="col-6">
        <li class="list-group-item" style="margin-top: 2px; background-color:rgb(250, 250, 250);">
            <div class="list-group-item-heading">
                <small>#{{ task.id  }}</small> 
                <h6 class="h-inline mt-title" {% if task.task_type == 1 %} style="color:green;" {% endif %}>{{ task.name }}</h6>
            </div>
            <div class="row">
                <div class="col">
                    <small><p class="list-group-item-text">用时: {{ task.need_minute }}m</p></small>
                    
                </div>
                <div style="margin-left:auto; margin-right: 10px;">
                    <a href="{{ url_for('.task_clock', task_id=task.id) }}"
                        class="btn btn-success btn" role="button">开始</a>
                    <a href="{{ url_for('.task_submit', task_id=task.id, next=request.endpoint) }}"
                        class="btn btn-info btn" role="button">提交</a>
                    {{ modal_botton(
                        id='delete' + [task.id] | join,
                        btn_class='btn-danger btn',
                        btn_name='删除', title='提醒',
                        body='你确定删除任务 ' + task.name + ' 吗？删除后不可恢复！',
                        footer_href=url_for('.task_delete', task_id=task.id)
                    )}}
                </div>
            </div>
        </li>
    </div>
    {% endif %} {% endfor %}   
</div>
{% endfor %}
{% endblock %}